package com.qlslylq.ad.sdk.model.rsp;

import android.text.TextUtils;

import com.qlslylq.ad.sdk.enums.AdPlatformEnum;
import com.qlslylq.ad.sdk.enums.AdType;

import java.io.Serializable;

/**
 * 广告配置<br/>
 */
public class AdPlaceWebConfigureVO implements Serializable {

    private long adSourceId;

    private String measureSign;

    private String platformSign;

    private String positionId;

    private int weight;

    //本地辅助-广告类型
    private AdType adType;

    //本地辅助-广告平台
    private AdPlatformEnum platform;

    //本地辅助-所属组
    private int groupIndex = -1;

    public long getAdSourceId() {
        return adSourceId;
    }

    public void setAdSourceId(long adSourceId) {
        this.adSourceId = adSourceId;
    }

    public String getMeasureSign() {
        return measureSign;
    }

    public void setMeasureSign(String measureSign) {
        this.measureSign = measureSign;
    }

    public String getPlatformSign() {
        return platformSign;
    }

    public void setPlatformSign(String platformSign) {
        this.platformSign = platformSign;
    }

    public String getPositionId() {
        return positionId;
    }

    public void setPositionId(String positionId) {
        this.positionId = positionId;
    }

    public int getWeight() {
        return weight;
    }

    public void setWeight(int weight) {
        this.weight = weight;
    }

    public AdType getAdType() {
        return adType;
    }

    public void setAdType(AdType adType) {
        this.adType = adType;
    }

    /**
     * 获取平台<br/>
     */
    public AdPlatformEnum getPlatform() {
        if (platform == null) {
            platform = AdPlatformEnum.getEnumByName(platformSign);
        }
        return platform;
    }

    public int getGroupIndex() {
        return groupIndex;
    }

    public void setGroupIndex(int groupIndex) {
        this.groupIndex = groupIndex;
    }

    /**
     * 是否为半屏<br/>
     */
    public boolean isHalf() {
        if (TextUtils.isEmpty(measureSign)) {
            return true;
        }
        if (measureSign.contains("full")) {
            return false;
        }
        return true;
    }
}
